const fs = require("fs");
const path = require("path");
const readline = require("readline");

const fileName = path.resolve(__dirname, "../../logs/access.log");

const readStream = fs.createReadStream(fileName);

const rl = readline.createInterface({
  input: readStream,
});
let chrome = 0;
let total = 0;
rl.on("line", function (lineData) {
  if (!lineData) {
    return;
  }
  total++;
  if (lineData.indexOf("Chrome") > 0) {
    chrome++;
  }
});
rl.on("close", () => {
  console.log("all right", chrome / total);
});
